<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>octant.tools</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="octant-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="octant-module.html">Package&nbsp;octant</a> ::
        Module&nbsp;tools
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
      </table>
    </td>
  </tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module tools</h1><p class="nomargin-top"><span class="codelink"><a href="octant.tools-pysrc.html">source&nbsp;code</a></span></p>
Tools for working with ROMS model input and output.

<!-- ==================== CLASSES ==================== -->
<a name="section-Classes"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Classes</span></td>
</tr>
<tr>
    <td class="summary" colspan="2">
        <a href="octant.tools.Transect_extrapolator-class.html" class="summary-name">Transect_extrapolator</a><br />
      General Transect object
    </td>
  </tr>
</table>
<!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Functions</span></td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="octant.tools-module.html#N2" class="summary-sig-name">N2</a>(<span class="summary-sig-arg">rho</span>,
        <span class="summary-sig-arg">z</span>,
        <span class="summary-sig-arg">rho_0</span>=<span class="summary-sig-default">1000.0</span>)</span><br />
      Return the stratification frequency</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="octant.tools-pysrc.html#N2">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="octant.tools-module.html#arg_nearest" class="summary-sig-name">arg_nearest</a>(<span class="summary-sig-arg">x</span>,
        <span class="summary-sig-arg">xo</span>,
        <span class="summary-sig-arg">scale</span>=<span class="summary-sig-default">None</span>)</span><br />
      returns indices of closest point in an N arrays.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="octant.tools-pysrc.html#arg_nearest">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="extrapolate_mask"></a><span class="summary-sig-name">extrapolate_mask</span>(<span class="summary-sig-arg">a</span>,
        <span class="summary-sig-arg">mask</span>=<span class="summary-sig-default">None</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="octant.tools-pysrc.html#extrapolate_mask">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="iso_integrate"></a><span class="summary-sig-name">iso_integrate</span>(<span class="summary-sig-arg">z_w</span>,
        <span class="summary-sig-arg">q</span>,
        <span class="summary-sig-arg">z_iso</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="octant.tools-pysrc.html#iso_integrate">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="octant.tools-module.html#isoslice" class="summary-sig-name">isoslice</a>(<span class="summary-sig-arg">z</span>,
        <span class="summary-sig-arg">q</span>,
        <span class="summary-sig-arg">zo</span>=<span class="summary-sig-default">0</span>,
        <span class="summary-sig-arg">mode</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">spline</code><code class="variable-quote">'</code></span>)</span><br />
      Return a slice a 3D field along an isosurface.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="octant.tools-pysrc.html#isoslice">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="nanmask"></a><span class="summary-sig-name">nanmask</span>(<span class="summary-sig-arg">a</span>)</span><br />
      Return masked array with mask defined by NaNs.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="octant.tools-pysrc.html#nanmask">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="rot2d"></a><span class="summary-sig-name">rot2d</span>(<span class="summary-sig-arg">x</span>,
        <span class="summary-sig-arg">y</span>,
        <span class="summary-sig-arg">ang</span>)</span><br />
      rotate vectors by geometric angle</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="octant.tools-pysrc.html#rot2d">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="octant.tools-module.html#shrink" class="summary-sig-name">shrink</a>(<span class="summary-sig-arg">a</span>,
        <span class="summary-sig-arg">b</span>)</span><br />
      Return array shrunk to fit a specified shape by triming or averaging.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="octant.tools-pysrc.html#shrink">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="surface"></a><span class="summary-sig-name">surface</span>(<span class="summary-sig-arg">z</span>,
        <span class="summary-sig-arg">q</span>,
        <span class="summary-sig-arg">qo</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="octant.tools-pysrc.html#surface">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== VARIABLES ==================== -->
<a name="section-Variables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Variables</span></td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="gc_dist"></a><span class="summary-name">gc_dist</span> = <code title="&lt;numpy.lib.function_base.vectorize object at 0x59205b0&gt;">&lt;numpy.lib.function_base.vectorize object at 0x59205b0&gt;</code>
    </td>
  </tr>
</table>
<!-- ==================== FUNCTION DETAILS ==================== -->
<a name="section-FunctionDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Function Details</span></td>
</tr>
</table>
<a name="N2"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">N2</span>(<span class="sig-arg">rho</span>,
        <span class="sig-arg">z</span>,
        <span class="sig-arg">rho_0</span>=<span class="sig-default">1000.0</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="octant.tools-pysrc.html#N2">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Return the stratification frequency</p>
<div class="rst-section">
<h1 class="heading"><a id="rst-parameters" name="rst-parameters">Parameters</a></h1>
<dl class="rst-docutils">
<dt>rho <span class="classifier-delimiter">:</span> <span class="rst-classifier">array_like</span></dt>
<dd>density [kg/m^3]</dd>
<dt>z <span class="classifier-delimiter">:</span> <span class="rst-classifier">array_like</span></dt>
<dd>depths [m] (positive upward)</dd>
</dl>
</div>
<div class="rst-section">
<h1 class="heading"><a id="rst-returns" name="rst-returns">Returns</a></h1>
<dl class="rst-docutils">
<dt>N2 <span class="classifier-delimiter">:</span> <span class="rst-classifier">array_like</span></dt>
<dd>Stratification frequency [1/s], where the vertical dimension (the
first dimension) is one less than the input arrays.</dd>
</dl>
</div>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="arg_nearest"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">arg_nearest</span>(<span class="sig-arg">x</span>,
        <span class="sig-arg">xo</span>,
        <span class="sig-arg">scale</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="octant.tools-pysrc.html#arg_nearest">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>returns indices of closest point in an N arrays.</p>
<div class="rst-section">
<h1 class="heading"><a id="rst-parameters" name="rst-parameters">Parameters</a></h1>
<dl class="rst-docutils">
<dt>x <span class="classifier-delimiter">:</span> <span class="rst-classifier">tuple of N ndarray objects</span></dt>
<dd>N ndarrays of coordinate variables that define an N-dimensional space.
All arrays must have the same shape.</dd>
<dt>xo <span class="classifier-delimiter">:</span> <span class="rst-classifier">array_like</span></dt>
<dd>len(N) array representing the query point.</dd>
<dt>scale <span class="classifier-delimiter">:</span> <span class="rst-classifier">array_like, optional</span></dt>
<dd>len(N) array of values to multiply by each coordinate variable by
before distance is calculated.</dd>
</dl>
</div>
<div class="rst-section">
<h1 class="heading"><a id="rst-returns" name="rst-returns">Returns</a></h1>
<dl class="rst-docutils">
<dt>indexes <span class="classifier-delimiter">:</span> <span class="rst-classifier">ndarray</span></dt>
<dd>An array of indicies such that (x[idx], y[idx], z[idx], ...) is the
closest point to xo</dd>
</dl>
</div>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="isoslice"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">isoslice</span>(<span class="sig-arg">z</span>,
        <span class="sig-arg">q</span>,
        <span class="sig-arg">zo</span>=<span class="sig-default">0</span>,
        <span class="sig-arg">mode</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">spline</code><code class="variable-quote">'</code></span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="octant.tools-pysrc.html#isoslice">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Return a slice a 3D field along an isosurface.</p>
<p>result is a a projection of variable at property == isoval in the first
nonsingleton dimension.  In the case when there is more than one zero
crossing, the results are averaged.</p>
<p>EXAMPLE:
Assume two three dimensional variable, s (salt), z (depth), and
u (velicity), all on the same 3D grid.  x and y are the horizontal
positions, with the same horizontal dimensions as z (the 3D depth
field).  Here, assume the vertical dimension, that will be projected,
is the first.</p>
<p>s_at_m5  = isoslice(s,z,-5);        # s at z == -5
h_at_s30 = isoslice(z,s,30);       # z at s == 30
u_at_s30 = isoslice(u,s,30);       # u at s == 30</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="shrink"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">shrink</span>(<span class="sig-arg">a</span>,
        <span class="sig-arg">b</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="octant.tools-pysrc.html#shrink">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Return array shrunk to fit a specified shape by triming or averaging.</p>
<p>a = shrink(array, shape)</p>
<p>array is an numpy ndarray, and shape is a tuple (e.g., from
array.shape). a is the input array shrunk such that its maximum
dimensions are given by shape. If shape has more dimensions than
array, the last dimensions of shape are fit.</p>
<p>as, bs = shrink(a, b)</p>
<p>If the second argument is also an array, both a and b are shrunk to
the dimensions of each other. The input arrays must have the same
number of dimensions, and the resulting arrays will have the same
shape.</p>
<div class="rst-section">
<h1 class="heading"><a id="rst-example" name="rst-example">Example</a></h1>
<pre class="py-doctest">
<span class="py-prompt">&gt;&gt;&gt; </span>shrink(rand(10, 10), (5, 9, 18)).shape
<span class="py-output">(9, 10)</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span>map(shape, shrink(rand(10, 10, 10), rand(5, 9, 18)))
<span class="py-output">[(5, 9, 10), (5, 9, 10)]</span></pre>
</div>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="octant-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1
    on Mon Apr 20 11:56:30 2009
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
